#include <iostream>
#include <string>
#include <pthread.h>
#include <unistd.h>
void *thread_run(void *arg)
{
    std::string str = (const char *)arg;
    while (true)
    {
        std::cout << "I am a thread , my name is " << str << std::endl;
        sleep(1);
    }
    return nullptr;
}

int main()
{
    pthread_t tid;
    pthread_create(&tid, nullptr, thread_run, (void *)"thread-1");

    while (true)
    {
        std::cout << "I am main thread" << std::endl;
        sleep(1);
    }

    return 0;
}